<template>
  <el-dialog width='50%' append-to-body @close='close' :visible.sync='visible'>
    content
    {{ obj }}
  </el-dialog>
</template>

<script>
export default {
  name: 'child',
  props: {
    obj: {
      type: Object,
      default: () => {
      }
    },
    visible: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      visible: this.visible,
      obj: this.obj
    }
  },
  methods: {
    close() {
      this.$emit('close', false)
      this.$emit('update:visible', false)
    }
  },
  created() {
    console.log('obj:', this.obj)
    console.log('child-created')
  },
  beforeCreated() {
    console.log('child-beforeCreated')
  },
  mounted() {
    console.log('child-mounted')
  },
  beforeMounted() {
    console.log('child-beforeMounted')
  },
  destroy() {
    console.log('child-destroy')
  }
}
</script>

